

INCLUDE_DIRECTORIES(
${BULLET_PHYSICS_SOURCE_DIR}/src 
${BULLET_PHYSICS_SOURCE_DIR}/Demos/SharedOpenCL
${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL
${AMD_OPENCL_INCLUDES}
)

ADD_DEFINITIONS(-DUSE_AMD_OPENCL)
ADD_DEFINITIONS(-DCL_PLATFORM_AMD)

IF(WIN32)
ADD_DEFINITIONS(-DGLEW_STATIC)
ENDIF(WIN32)

IF (CMAKE_CL_64)
	SET(CMAK_GLEW_LIBRARY
		${BULLET_PHYSICS_SOURCE_DIR}/Glut/glew64s.lib		)
ELSE(CMAKE_CL_64)
	SET(CMAK_GLEW_LIBRARY		${BULLET_PHYSICS_SOURCE_DIR}/Glut/glew32s.lib		)
ENDIF(CMAKE_CL_64)


IF (USE_GLUT)
	LINK_LIBRARIES(
		OpenGLSupport 
		BulletSoftBodySolvers_OpenCL_AMD
		BulletMultiThreaded
		BulletSoftBody
		BulletDynamics  
		BulletCollision  
		LinearMath 
		${GLUT_glut_LIBRARY} 
		${OPENGL_gl_LIBRARY} 
		${OPENGL_glu_LIBRARY}
		${CMAK_GLEW_LIBRARY}
			${CMAKE_ATISTREAMSDK_LIBRARY}
	)


	ADD_EXECUTABLE(AppOpenCLClothDemo_AMD
		../cl_cloth_demo.cpp
					${BULLET_PHYSICS_SOURCE_DIR}/Demos/SharedOpenCL/btOpenCLUtils.cpp
					${BULLET_PHYSICS_SOURCE_DIR}/Demos/SharedOpenCL/btOpenCLUtils.h
					${BULLET_PHYSICS_SOURCE_DIR}/Demos/SharedOpenCL/btOpenCLInclude.h
#		${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL/GLDebugDrawer.cpp
		../gl_win.cpp
		../clstuff.cpp


		../clstuff.h
		../gl_win.h
		../cloth.h

	)
ELSE (USE_GLUT)
ENDIF (USE_GLUT)

IF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)
	IF(WIN32)
		IF (CMAKE_CL_64)
			ADD_CUSTOM_COMMAND(	TARGET AppOpenCLClothDemo_AMD		POST_BUILD
						COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/glut64.dll ${CMAKE_CURRENT_BINARY_DIR}	
						)
		ELSE(CMAKE_CL_64)
		
			ADD_CUSTOM_COMMAND(	TARGET AppOpenCLClothDemo_AMD	POST_BUILD
						COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/GLUT32.DLL ${CMAKE_CURRENT_BINARY_DIR}
						)
		ENDIF(CMAKE_CL_64)
	ENDIF(WIN32)
	ADD_CUSTOM_COMMAND(	TARGET AppOpenCLClothDemo_AMD	POST_BUILD
			COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/bullet_logo.png ${CMAKE_CURRENT_BINARY_DIR}
	)
ENDIF(NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES)

IF (UNIX)
  TARGET_LINK_LIBRARIES(AppOpenCLClothDemo_AMD pthread)
ENDIF(UNIX)

IF (INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
			SET_TARGET_PROPERTIES(AppOpenCLClothDemo_AMD PROPERTIES  DEBUG_POSTFIX "_Debug")
			SET_TARGET_PROPERTIES(AppOpenCLClothDemo_AMD PROPERTIES  MINSIZEREL_POSTFIX "_MinsizeRel")
			SET_TARGET_PROPERTIES(AppOpenCLClothDemo_AMD PROPERTIES  RELWITHDEBINFO_POSTFIX "_RelWithDebugInfo")
ENDIF(INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
